package com.qf.test3;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;

public class CopyPicByByte {
	
	public static void main(String[] args) {
		//3.编程实现使用字节流拷贝一个图片文件
		
		File file1 = new File("./src/com/qf/test3/捕获.PNG");
		File file2 = new File("./src/com/qf/test3/pic.PNG");
		try {
			FileInputStream in = new FileInputStream(file1);
			
			FileOutputStream out= new FileOutputStream(file2);
			
			
			byte[] bs = new byte[10];
			int len =-1;
			while((len=in.read(bs))!=-1) {
				
				out.write(bs);
			}
			
			
			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}catch(Exception e) {
			
			e.printStackTrace();
		}
		
	}

}
